package com.atguigu.study.controller;

import dev.langchain4j.model.chat.ChatModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Marco
 * @Description
 * @date 2025/8/15 22:27
 * @email 3293336923@qq.com
 */
@RestController
@Slf4j
public class HelloLangChain4JController {

    @Autowired
    private ChatModel chatModel;

    @GetMapping("langchain/marco")
    public    String    answerQuestionController(@RequestParam(value = "question" ,defaultValue = "你是谁?") String  question){

        String result = chatModel.chat(question);
        log.info("result:{}" , result);
        return  result;
    }

}
